package core.entities;

/**
 * DifficultyLevel enumeration<BR />
 * This enumeration defines all the available difficulty levels for the game.<BR />
 * A difficulty level is also defined by an integer from easiest to hardest
 * level.
 * 
 * @author Y. Bondue
 * 
 */
public enum DifficultyLevel {

	EASY("Easy mode", 0, 3.0),
	MEDIUM("Medium mode", 1, 1.5),
	HARD("Hard mode",2, 0.5),
	EXTREME("Extreme mode", 3, 0),
	SPECIAL("Special cards", Integer.MAX_VALUE, 0);

	private String description;
	private int level;
	private double handicap;

	private DifficultyLevel(String description, int level, double handicap) {
		this.description = description;
		this.level = level;
		this.handicap = handicap;
	}

	public String getDescription() {
		return description;
	}

	public int getLevelAsInteger() {
		return level;
	}

	public double getHandicap() {
		return handicap;
	}

	public static DifficultyLevel getDifficultyByInteger(int level) {
		DifficultyLevel chosen;
		switch (level) {
		case 0:
			chosen = EASY;
			break;
		case 1:
			chosen = MEDIUM;
			break;
		case 2:
			chosen = HARD;
			break;
		case 3:
			chosen = EXTREME;
			break;
		default:
			chosen = MEDIUM;
			break;
		}
		return chosen;
	}
}
